package com.cssy.xxkj.logic.dao.impl;

import com.cssy.xxkj.logic.dao.LogicProductionStorageoutItemDAO;
import com.cssy.xxkj.logic.entity.LogicProductionStorageoutItemDO;
import com.plat.helper.SearchConditions;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-10-09
 */
public class LogicProductionStorageoutItemDAOImpl extends SqlMapClientDaoSupport implements LogicProductionStorageoutItemDAO {

    /**
     * 插入数据
     * @param logicProductionStorageoutItemDO
     * @return 插入数据的主键
     */
    public String insertLogicProductionStorageoutItemDO(LogicProductionStorageoutItemDO logicProductionStorageoutItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicProductionStorageoutItem.insert", logicProductionStorageoutItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicProductionStorageoutItemDO
     * @return 查出的记录数
     */
    public Integer countLogicProductionStorageoutItemDOByExample(LogicProductionStorageoutItemDO logicProductionStorageoutItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionStorageoutItem.countByDOExample", logicProductionStorageoutItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicProductionStorageoutItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicProductionStorageoutItemDO(LogicProductionStorageoutItemDO logicProductionStorageoutItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicProductionStorageoutItem.update", logicProductionStorageoutItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicProductionStorageoutItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicProductionStorageoutItemDO> findListByExample(LogicProductionStorageoutItemDO logicProductionStorageoutItemDO) throws DataAccessException {
        List<LogicProductionStorageoutItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionStorageoutItem.findListByDO", logicProductionStorageoutItemDO);
        return list;
    }
    
    public List<LogicProductionStorageoutItemDO> findListByMap(Map<String, Object> paramMap)throws DataAccessException{
    	List<LogicProductionStorageoutItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionStorageoutItem_ex.findListByMap", paramMap);
        return list;
    }

    /**
     * 根据主键获取logicProductionStorageoutItemDO
     * @param id
     * @return logicProductionStorageoutItemDO
     */
    public LogicProductionStorageoutItemDO findLogicProductionStorageoutItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicProductionStorageoutItemDO logicProductionStorageoutItemDO = (LogicProductionStorageoutItemDO) getSqlMapClientTemplate().queryForObject("LogicProductionStorageoutItem.findByPrimaryKey", id);
        return logicProductionStorageoutItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicProductionStorageoutItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionStorageoutItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicProductionStorageoutItemDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicProductionStorageoutItemDO> list = getSqlMapClientTemplate().queryForList("LogicProductionStorageoutItem_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicProductionStorageoutItem_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Integer deleteProById(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicProductionStorageoutItem_ex.deleteProById", id);
        return rows;
	}

}